<script setup>
import { RouterLink, RouterView, useRoute, useRouter } from 'vue-router'
import { useCounterStore } from '@/stores/index'
const router = useRouter()
const route = useRoute()
console.log(route, router)
// const to = () => {
//   router.push('/home')
// }
const counterStore = useCounterStore()

// 引入login的api
import { login } from '@/api/login'
const goHttp = async () => {
  const res = await login({})
  console.log(res) // 这个res就是mock处理函数返回的数据
}

import { list } from '@/api/infomation'
const goHttp2 = async () => {
  const res = await list({})
  // const res = await axios.get('http://www.baidu.com')
  console.log(res) // 这个res就是mock处理函数返回的数据
}
goHttp2()
</script>

<template>
  <header>
    <img
      alt="Vue logo"
      class="logo"
      src="@/assets/logo.svg"
      width="125"
      height="125"
    />

    <el-button type="danger" @click="goHttp()">获取百度信息</el-button>
    <el-button type="success" @click="counterStore.increment()"
      >Success</el-button
    >
    <li>{{ counterStore.count }}</li>
    <el-button @click="$router.push('/home')"></el-button>
    <hr />
    <div class="wrapper">
      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
      </nav>
    </div>
  </header>

  <RouterView />
</template>

<style scoped></style>
